package com.travel.service.tourist_demand;

import com.travel.common.ServerResponse;
import com.travel.dao.tourist_demand.TouristRecordsMapper;
import com.travel.pojo.tourist_demand.TouristRecords;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TouristRecordsServer {

    @Autowired
    private TouristRecordsMapper touristRecordsMapper;


    /**
     * 查询旅行记录接口,返回部分团信息
     * @param userid 用户id
     */
    public ServerResponse<List<TouristRecords>> selectTouristRecordsByUserId(int userid){
        List<TouristRecords> recordsList=touristRecordsMapper.selectTouristRecordsByUserId(userid);
        if (recordsList.size()==0){
            return ServerResponse.createByErrorMessage("还没有加入团");
        }else {
            return ServerResponse.createBySuccess("您的旅行记录如下",recordsList);
        }
        }


    }
